<template>
		<view class="cu-info" v-if="$tool.in_array(user.id,message.data.extra.can_vote_user_ids)">
			<view class="solids-bottom  flex align-center">
				<view class="flex-sub text-center">
					<view class="solid-bottom text-lg">
						<text class="text-black">{{message.from.name}}:申请加入</text>
					</view>
					<view class="solid-bottom text-sm padding-xs">
						<text class="text-grey">请投入您的宝贵一票吧</text>
					</view>
					<view class="solid-bottom text-sm padding-xs">
						<text class="cu-info">{{message.data.content}}</text>
					</view>
				</view>
			</view>
			<!-- 对方开启了好友验证，你还不是他(她)的好友。请先发送好友验证请求，对方验证通过后，才能聊天。
			<text class="text-blue">发送好友验证</text> -->
			<view class="" >
				<view class="solids-bottom  flex align-center">
					<view class="padding-xs">已同意用户</view>
					<view class="flex-sub text-center">
						<view class="padding-xs">{{agree_users_names}}</view>
					</view>
				</view>
				<view class="solids-bottom flex align-center">
					<view class="padding-xs">已拒绝用户</view>
					<view class="flex-sub text-center">
						<view class="padding-xs">{{refuse_users_names}}</view>
					</view>
				</view>
				<view class="solids-bottom flex align-center">
					<view class="padding-xs">已弃权用户</view>
					<view class="flex-sub text-center">
						<view class="padding-xs">{{waiver_users_names}}</view>
					</view>
				</view>
				<view class="" v-if="!if_vote">
					<view class="flex flex-treble justify-around padding-xs">
						<view class="">
							<button class="cu-btn round sm" :class="['bg-blue', 'shadow']" @click="random_chat_vote({message:message,type:'refuse'})">拒绝</button>
						</view>
						<view class="">
							<button class="cu-btn round sm" :class="['bg-blue', 'shadow']" @click="random_chat_vote({message:message,type:'waiver'})">弃权</button>
						</view>
						<view class="">
							<button class="cu-btn round sm" :class="['bg-blue', 'shadow']" @click="random_chat_vote({message:message,type:'agree'})">同意</button>
						</view>
					</view>
				</view>
				<view class="" v-else>
					<view class="solids-bottom  flex align-center">
						<view class="flex-sub text-center">
							<view class="solid-bottom text-sm padding-xs">
								<text class="cu-info">您已投过票</text>
							</view>
						</view>
					</view>
				</view>
				<view class="">
					
				</view>
				<view class="" v-if="message.data.extra.if_pass">
					<view class="solids-bottom  flex align-center">
						<view class="flex-sub text-center">
							<view class="solid-bottom text-sm padding-xs">
								<text class="cu-info">投票通过</text>
							</view>
						</view>
					</view>
				</view>
			
				
			</view>

	
			
		</view>
</template>

<script>
	import app from '@/mixins/app.js'
	import random_chat from '@/mixins/random_chat.js'
	export default{
		props: {
			message: {
				type: [Object],
				default:()=>{
					return {}
				}
			},
			
		},
		computed:{
			agree_users(){
				return this.message.data.extra.agree_users||[]
			},
			agree_users_names(){
				return this.agree_users.map((item)=>{
					return item.name
				}).join(',')
			},
			refuse_users(){
				return this.message.data.extra.refuse_users||[]
			},
			refuse_users_names(){
				return this.refuse_users.map((item)=>{
					return item.name
				}).join(',')
			},
			waiver_users(){
				return this.message.data.extra.waiver_users||[]
			},
			waiver_users_names(){
				return this.waiver_users.map((item)=>{
					return item.name
				}).join(',')
			},
			if_vote(){
				return this.$tool.in_array(this.user.id,this.message.data.extra.vote_user_ids)
			}
		},
		mixins:[app,random_chat],
		methods:{
			
		}
		
	}
</script>

<style>
</style>
